package ubiqweb.spring3.controller;


import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;

import org.apache.jasper.tagplugins.jstl.core.Redirect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;

import ubiqweb.spring3.model.LoginForm;

@Controller
@SessionAttributes
@RequestMapping("/logout")
public class LogoutController {
	
    @SuppressWarnings("unchecked")
	@RequestMapping(method = RequestMethod.GET)
    public String showForm(Map model, HttpSession session) {
    		session.invalidate();
            LoginForm loginForm = new LoginForm();
            model.put("loginForm", loginForm);
            model.put("logout", "You have successfully logged out.");
            return "home";
    }
}
